package cn.jlonely.xyhx.admin.controller;


import cn.jlonely.xyhx.admin.service.ReviewService;
import cn.jlonely.xyhx.pojo.vo.ReviewVo;
import cn.jlonely.xyhx.utils.PageResult;
import cn.jlonely.xyhx.utils.Result;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;


@Slf4j
@RestController
@RequestMapping("/admin")
public class ReviewController {
    @Autowired
    private ReviewService reviewService;

    /**
     * 获取审核分页
     * @param page
     * @param pageSize
     * @return
     */
    @GetMapping("/getReviewInfoPage")
    public Result getReviewInfo(@RequestParam("page") Integer page, @RequestParam("pageSize") Integer pageSize){
        PageResult<ReviewVo> reviews = reviewService.getReviewInfo(page,pageSize);
        return Result.success(reviews);
    }

    /**
     * 更新状态
     * @param id
     * @param judgeStatus
     * @return
     */
    @PutMapping("/updateReviewStatus")
    public Result updateReviewStatus(@RequestParam("id") Integer id,@RequestParam("judgeStatus") Integer judgeStatus){
        reviewService.updateReviewStatus(id, judgeStatus);
        return Result.success();
    }


}
